/*
 * @Author: cl
 * @Description: 基础变量使用
 * @Date: 2022-12-06 09:54:48
 * @LastEditTime: 2023-07-21 14:51:29
 * @FilePath: \jsnode\typescript\basics.ts
 */
//基础变量
{
    let a:number = 1;
    let b: string = "i am string";
    let c: boolean = false;
    
    let sum = (a: number, b: string) => {
      return a + b;
    };
    
    console.log(sum(123, "234"));
    
    let d: void = undefined;
    //严格模式下
    // let e :void = null;//不能赋值为null
    // let f :null = undefined;
    
    let g;
    g = 123;
    g = "234";
    let h = 123;
    // h = '123'
    
    let i: any = 123;
    i = "123";
    let j: any = {
        test:()=>{
            console.log('lalal')
        }
    };
    console.log(j.test)
    let k: unknown = {
        test:()=>{
            console.log('lalal')
        }
    };
    // console.log(k.test)
    let xx:string 
    xx = "ddd"
    
    
    console.log(xx)
    
    interface Person{
        name:string,
        age:number
    }
    
    let child:Person = {
        name:'张三',
        age:19
    }
    
    interface Boy extends Person{
        height:number,
        play?:string
    }
    
    let child2:Boy = {
        age:17,
        name:'里斯',
        height:175
    }
    let child3:Boy = {
        age:14,
        name:'王五',
        height:182,
        play:'篮球'
    }

    type Animal = {
        name:string,
        age:number
    }
    type keys = keyof Animal

   
    
    
}


